<a href='https://github.com/angular/angular.js/edit/v1.6.x/src/ngMock/angular-mocks.js?message=docs($exceptionHandlerProvider)%3A%20describe%20your%20change...#L195' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a>



<a href='https://github.com/angular/angular.js/tree/v1.6.6/src/ngMock/angular-mocks.js#L195' class='view-source pull-right btn btn-primary'>
  <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
</a>


<header class="api-profile-header">
  <h1 class="api-profile-header-heading">$exceptionHandlerProvider</h1>
  <ol class="api-profile-header-structure naked-list step-list">
    
  <li>
    <a href="api/ngMock/service/$exceptionHandler">- $exceptionHandler</a>
  </li>

    <li>
      - provider in module <a href="api/ngMock">ngMock</a>
    </li>
  </ol>
</header>





<div class="api-profile-description">
  <p>Configures the mock implementation of <a href="api/ng/service/$exceptionHandler"><code>$exceptionHandler</code></a> to rethrow or to log errors
passed to the <code>$exceptionHandler</code>.</p>

</div>




<div>
  

  

  

  
<h2>Methods</h2>
<ul class="methods">
  <li id="mode">
    <h3><p><code>mode(mode);</code></p>

</h3>
    <div><p>Sets the logging mode.</p>
</div>

    

    
    <h4>Parameters</h4>
    
<table class="variables-matrix input-arguments">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td>
        mode
        
        
      </td>
      <td>
        <a href="" class="label type-hint type-hint-string">string</a>
      </td>
      <td>
        <p>Mode of operation, defaults to <code>rethrow</code>.</p>
<ul>
<li><code>log</code>: Sometimes it is desirable to test that an error is thrown, for this case the <code>log</code>
mode stores an array of errors in <code>$exceptionHandler.errors</code>, to allow later assertion of
them. See <a href="api/ngMock/service/$log#assertEmpty">assertEmpty()</a> and
<a href="api/ngMock/service/$log#reset">reset()</a>.</li>
<li><code>rethrow</code>: If any errors are passed to the handler in tests, it typically means that there
is a bug in the application or test, so this mock will make these tests fail. For any
implementations that expect exceptions to be thrown, the <code>rethrow</code> mode will also maintain
a log of thrown errors in <code>$exceptionHandler.errors</code>.</li>
</ul>

        
      </td>
    </tr>
    
  </tbody>
</table>

    

    

    </li>
  </ul>
  
  



  
</div>


